package com.example.model.check_in;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 该类用于处理并返回报表数据
 */
public class CheckInData {
    BigDecimal amount;
    Integer total;
    Integer days;

    LocalDateTime dateTime;
    String favoriteRoomTypeName;

    List<CheckInData> list;

    public CheckInData() {
    }

    public CheckInData(Integer days) {
        this.days = days;
        this.list = new ArrayList<>();
        this.amount = BigDecimal.ZERO;
        this.total = 0;
    }

    public void calculate() {
        this.list.forEach(data -> {
            this.amount = this.amount.add(data.getAmount());
            this.total += data.getTotal();
        });
    }

    public void add(CheckInData checkInData) {
        this.list.add(checkInData);
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getDays() {
        return days;
    }

    public void setDays(Integer days) {
        this.days = days;
    }

    public List<CheckInData> getList() {
        return list;
    }

    public void setList(List<CheckInData> list) {
        this.list = list;
    }

    public LocalDateTime getDateTime() {
        return dateTime;
    }

    public void setDateTime(LocalDateTime dateTime) {
        this.dateTime = dateTime;
    }

    public String getFavoriteRoomTypeName() {
        return favoriteRoomTypeName;
    }

    public void setFavoriteRoomTypeName(String favoriteRoomTypeName) {
        this.favoriteRoomTypeName = favoriteRoomTypeName;
    }
}
